/*-----------------------------------------------------------------
*****************************************
With this dofile, we will replicate the tests of H1 and H3 in the paper entitled "Motivated reasoning and policy information: politicians are more resistant to debiasing interventions than the general public," written by Julian Christensen and Donald P. Moynihan and published in Behavioural Public Policy (doi:10.1017/bpp.2020.50)

To do so, we will be using three replication datasets (one containing politician data, one containing general public data, and one with the politicians and general public combined). Each dataset contains the following variables:

- prior_1 measures respondents' (dis)agreement with the following statement: "Many public activities could be produced both better and more cheaply by private providers." Possible responses: 1: Completely disagree, 2: partly disagree, 3: neither agree nor disagree, 4: partly agree, 5: completely agree, 6: Don't know.

- prior_2 measures respondents' (dis)agreement with the following statement: "We should to a larger degree outsource public services (such as child care, elder care, and hospital treatments)." Possible responses: 1: Completely disagree, 2: partly disagree, 3: neither agree nor disagree, 4: partly agree, 5: completely agree, 6: Don't know.

- prior_3 measures respondents' (dis)agreement with the following statement: "The public sector is best at providing public services." Possible responses: 1: Completely disagree, 2: partly disagree, 3: neither agree nor disagree, 4: partly agree, 5: completely agree, 6: Don't know.

- group indicates the experimental group of each respondent (1=grp A; 2=grp B; 3=grp C; 4=grp D; 5=grp E; 6=grp F).

- correctanswer is a dependent variable, coded as 1 if correct answer/respondent identifies best performing provider; 0 if false answer/respondent points to the worst performing provider as being best.

- falseanswer is an alternative dependent variable, coded as 1 if false answer; 0 if correct answer.

- sector_revealed is a dummy variable, coded to indicate whether the service provider's sector affiliation was revealed to respondents (grp C&D) or not (grp A&B) (used in tests of H1).
 
- pub_a_highestsatisfaction is a dummy variable, coded to indicate whether 1: in the experimental material, the public supplier/supplier A is shown as the best performing supplier (this is the case in experimental grps A, C, and E) or 0: the private supplier/supplier B is shown as the best performing supplier (this is the case in experimental grps B, D, and F).

- recentlyelected is a dummy variable, coded to separate recently elected politicians (1) from experienced politicians (0) (recently elected politicians had not been elected until the latest municipal election, i.e., the year before the data collection).

- attentive is a dummy variable, coded as 1 if respondents pass attention check and 0 if they do not. There was no attention check in the politician survey; All politicians are coded as being attentive.

- politician is a dummy variable, coded as 1 if respondents are from the politician sample and 0 if they are from the general public sample.

- polint_veryhigh is a dummy variable, coded as 1 if respondents are very politically interested and 0 if they are not. There were no political interest questions in the politician survey; For all politicians, this variable is coded as missing.

- justification_type_1 is a dummy variable, coded as 1 if a respondent's justification type is type 1 (cf. coding scheme in Supplementary Material S6A), else 0. For respondents in groups A-D (who were not asked to justify their evaluations), the variable is coded as missing.

- justification_type_2 is a dummy variable, coded as 1 if a respondent's justification type is type 2 (cf. coding scheme in Supplementary Material S6A), else 0. For respondents in groups A-D (who were not asked to justify their evaluations), the variable is coded as missing.

- justification_type_3 is a dummy variable, coded as 1 if a respondent's justification type is type 3 (cf. coding scheme in Supplementary Material S6A), else 0. For respondents in groups A-D (who were not asked to justify their evaluations), the variable is coded as missing. 

- justification_type_4 is a dummy variable, coded as 1 if a respondent's justification type is type 4 (cf. coding scheme in Supplementary Material S6A), else 0. For respondents in groups A-D (who were not asked to justify their evaluations), the variable is coded as missing. 

- justification_type_5 is a dummy variable, coded as 1 if a respondent's justification type is type 5 (cf. coding scheme in Supplementary Material S6A), else 0. For respondents in groups A-D (who were not asked to justify their evaluations), the variable is coded as missing. 

- justification_type_99 is a dummy variable, coded as 1 if a respondent's justification type is type 99 (cf. coding scheme in Supplementary Material S6A), else 0. For respondents in groups A-D (who were not asked to justify their evaluations), the variable is coded as missing.
*****************************************
-----------------------------------------------------------------*/

/*-----------------------------------------------------------------
*****************************************
We start by analyzing the politician data
*****************************************
-----------------------------------------------------------------*/

use "R:\Egen_forskning\Publicerede_papers\Christensen & Moynihan BPP - Motivated reasoning and policy information\Replication data and dofiles H1 H3\ReplicationDataPoliticiansH1H3_ANONYMIZED.dta", clear
set more off

/*-----------------------------------------------------------------
Coding of variables needed in order to test H1
-----------------------------------------------------------------*/

*An index is being created in order to measure information-related attitudes (0-1 with higher values corresponding to stronger preference for public delivery).
sum prior_1 prior_2 prior_3 
recode prior_1 prior_2 prior_3 (6=.)
recode prior_1 prior_2 (5=1) (4=2) (3=3) (2=4) (1=5)
alpha prior_1 prior_2 prior_3
generate pro_public = ((prior_1+ prior_2+ prior_3)-3)/12
tab pro_public
sum pro_public

*A histogram is being created to show the distribution of respondents' attitudes (Panel A of Supplementary Material S1: Distribution of Information Related Attitudes among Respondents)
histogram pro_public, discrete percent gap(0) xtitle(Support for public delivery) scheme(s2mono)

*A similar attitude index is being coded with higher values corresponding to stronger preference for private delivery
recode prior_1 prior_2 prior_3 (5=1) (4=2) (3=3) (2=4) (1=5)
generate pro_private = ((prior_1+ prior_2+ prior_3)-3)/12
histogram pro_private, discrete percent gap(0) xtitle(Support for public service provision) scheme(s2mono) 

*Variables are being coded to measure the (un)congeniality of the experimental material's information in light of respondents' attitudes (congeniality= pro_public if pub/A best and pro_private if priv/B best; uncongeniality is the reversed. NOTE: THESE VARIABLES MAKES NO SENSE IN PLACEBO GROUPS AND WILL NOT BE USED TO STUDY THOSE.
gen congeniality =.
replace congeniality = pro_public if pub_a_highestsatisfaction==1
replace congeniality = pro_private if pub_a_highestsatisfaction==0
gen uncongeniality =.
replace uncongeniality = pro_private if pub_a_highestsatisfaction==1
replace uncongeniality = pro_public if pub_a_highestsatisfaction==0

*An interaction term is being created in order to test H1 about stronger associations between attitudes and evaluations in grp C&D than in grp A&B
gen pro_publicXsector_revealed = pro_public*sector_revealed

/*-----------------------------------------------------------------
Test of H1: Motivated reasoning in the absence of justification requirements
-----------------------------------------------------------------*/

*H1 is being tested in group A&C (Model 1 of Supplementary Material S2: Regression Analyses Testing H1) 
logit correctanswer pro_public sector_revealed pro_publicXsector_revealed if pub_a_highestsatisfaction ==1 & group !=5
*H1 is tested in group B&D (Model 2 of Supplementary Material S2: Regression Analyses Testing H1)
logit correctanswer pro_public sector_revealed pro_publicXsector_revealed if pub_a_highestsatisfaction ==0 & group !=6 
*We test the association between congeniality and respondents' ability to identify the best performing supplier in groups C and D (Model 3 of Supplementary Material S2: Regression Analyses Testing H1) 
logit correctanswer congeniality if sector_revealed ==1 & group !=5 & group !=6

*Politician panel in Figure 2 is being created
logit falseanswer uncongeniality if sector_revealed ==1  & group !=5 & group !=6
margins, at(uncongeniality=(0(0.1)1)) vsquish
marginsplot, ytitle("Error rate") xtitle("Uncongeniality of information") legend(off) title("") graphregion(fcolor(white) lcolor(white)) recast(line) plotopts(lcolor(black)) recastci(rline) ciopts(lpattern(dash)) scheme(s2mono) 

/*-----------------------------------------------------------------
Coding of variables needed in order to test H3
-----------------------------------------------------------------*/

*A dummy variable is being coded to indicate whether 1: respondents have been asked to justify their evaluation (grp E&F) or 0: respondents have not been asked to justify their evaluation (grpC&D)
gen justification =.
replace justification = 1 if group==5
replace justification = 1 if group==6
replace justification = 0 if group==3
replace justification = 0 if group==4

*An interaction term is being created to test H3 about a moderating effect of justification requirements on the tendency to be biased by information-related attitudes
gen congenialityXjustification = congeniality*justification

/*-----------------------------------------------------------------
Test of H3: Debiasing effects of justification requirements?
-----------------------------------------------------------------*/

*H3 is being tested (Models 1-2 of Table 2: Moderating effects of justification requirements on influence of attitudes)
logit correctanswer congeniality justification //Model 1 of Table 2
logit correctanswer congeniality justification congenialityXjustification //Model 2 of Table 2

*Predicted probabilities of correctanswer=1 are estimated at different levels of congeniality with and without justification requirements 
logit correctanswer congeniality if justification ==0 
margins, at(congeniality = (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1))
logit correctanswer congeniality if justification ==1  
margins, at(congeniality = (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1))

/*-----------------------------------------------------------------
Explorative test of H3 among recently elected politicians (who had, at the time of the data collection, only been member of a city council since the 2013 election) and among more experienced politicians (i.e., respondents who were already member of a council before the 2013 election) (Reported in Table 3: Recently elected versus experienced politicians)
-----------------------------------------------------------------*/

logit correctanswer congeniality justification congenialityXjustification if recentlyelected==1 //Model 1 of Table 3
logit correctanswer congeniality justification congenialityXjustification if recentlyelected==0 //Model 2 of Table 3


/*-----------------------------------------------------------------
Explorative analyses of the qualitative content of respondents' arguments/justifications (Reported in Supplementary Material S6: Qualitative Content Analysis of Written Justifications)
-----------------------------------------------------------------*/

*We look at the distributions of different justification types among recently elected and among experienced politicians (reported in Supplementary Material S6b)
tab justification_type_1 if recentlyelected==1 //justification type 1 (cf. coding scheme in Supplementary Material S6a) among recently elected politicians
tab justification_type_1 if recentlyelected==0 //justification type 1 (cf. coding scheme in Supplementary Material S6a) among experienced politicians
tab justification_type_2 if recentlyelected==1 //justification type 2 (cf. coding scheme in Supplementary Material S6a) among recently elected politicians
tab justification_type_2 if recentlyelected==0 //justification type 2 (cf. coding scheme in Supplementary Material S6a) among experienced politicians
tab justification_type_3 if recentlyelected==1 //justification type 3 (cf. coding scheme in Supplementary Material S6a) among recently elected politicians
tab justification_type_3 if recentlyelected==0 //justification type 3 (cf. coding scheme in Supplementary Material S6a) among experienced politicians
tab justification_type_4 if recentlyelected==1 //justification type 4 (cf. coding scheme in Supplementary Material S6a) among recently elected politicians
tab justification_type_4 if recentlyelected==0 //justification type 4 (cf. coding scheme in Supplementary Material S6a) among experienced politicians
tab justification_type_5 if recentlyelected==1 //justification type 5 (cf. coding scheme in Supplementary Material S6a) among recently elected politicians
tab justification_type_5 if recentlyelected==0 //justification type 5 (cf. coding scheme in Supplementary Material S6a) among experienced politicians
tab justification_type_99 if recentlyelected==1 //justification type 99 (cf. coding scheme in Supplementary Material S6a) among recently elected politicians
tab justification_type_99 if recentlyelected==0 //justification type 99 (cf. coding scheme in Supplementary Material S6a) among experienced politicians

*We test for associations between attitude congeniality and justification content (reported in Supplementary Material S6c)
gen justification_type_1_or_2 = .
replace justification_type_1_or_2 = 1 if justification_type_1==1
replace justification_type_1_or_2 = 1 if justification_type_2==1
replace justification_type_1_or_2 = 0 if justification_type_3==1
replace justification_type_1_or_2 = 0 if justification_type_4==1
replace justification_type_1_or_2 = 0 if justification_type_5==1
replace justification_type_1_or_2 = 0 if justification_type_99==1
logit justification_type_1_or_2 congeniality if recentlyelected==1 & correctanswer!=. //Model 1 of Supplementary Table S6ca (Note: the "correctanswer!=." command removes respondents who did not answer the dependent variable in our experiment)
logit justification_type_1_or_2 congeniality if recentlyelected==0 & correctanswer!=. //Model 2 of Supplementary Table S6ca
logit justification_type_1 congeniality if recentlyelected==1 & correctanswer!=. //Model 1 of Supplementary Table S6cb
logit justification_type_1 congeniality if recentlyelected==0 & correctanswer!=. //Model 2 of Supplementary Table S6cb
logit justification_type_2 congeniality if recentlyelected==1 & correctanswer!=. //Model 1 of Supplementary Table S6cc
logit justification_type_2 congeniality if recentlyelected==0 & correctanswer!=. //Model 2 of Supplementary Table S6cc
logit justification_type_3 congeniality if recentlyelected==1 & correctanswer!=. //Model 1 of Supplementary Table S6cd
logit justification_type_3 congeniality if recentlyelected==0 & correctanswer!=. //Model 2 of Supplementary Table S6cd
logit justification_type_4 congeniality if recentlyelected==1 & correctanswer!=. //Model 1 of Supplementary Table S6ce
logit justification_type_4 congeniality if recentlyelected==0 & correctanswer!=. //Model 2 of Supplementary Table S6ce
logit justification_type_5 congeniality if recentlyelected==1 & correctanswer!=. //Model 1 of Supplementary Table S6cf
logit justification_type_5 congeniality if recentlyelected==0 & correctanswer!=. //Model 2 of Supplementary Table S6cf
logit justification_type_99 congeniality if recentlyelected==1 & correctanswer!=. //Model 1 of Supplementary Table S6cg
logit justification_type_99 congeniality if recentlyelected==0 & correctanswer!=. //Model 2 of Supplementary Table S6cg


/*-----------------------------------------------------------------
*****************************************
We move on to analyzing the general public data
*****************************************
-----------------------------------------------------------------*/

use "R:\Egen_forskning\Publicerede_papers\Christensen & Moynihan BPP - Motivated reasoning and policy information\Replication data and dofiles H1 H3\ReplicationDataGeneralPublicH1H3.dta", clear
set more off

/*-----------------------------------------------------------------
Coding of variables needed in order to test H1
-----------------------------------------------------------------*/

*An index is being created in order to measure information-related attitudes (0-1 with higher values corresponding to stronger preference for public delivery).
sum prior_1 prior_2 prior_3 
recode prior_1 prior_2 prior_3 (6=.)
recode prior_1 prior_2 (5=1) (4=2) (3=3) (2=4) (1=5)
alpha prior_1 prior_2 prior_3
generate pro_public = ((prior_1+ prior_2+ prior_3)-3)/12
tab pro_public
sum pro_public

*A histogram is being created to show the distribution of respondents' attitudes (Panel B of Supplementary Material S1: Distribution of Information Related Attitudes among Respondents)
histogram pro_public, discrete percent gap(0) xtitle(Support for public service provision) scheme(s2mono)

*A similar attitude index is being coded with higher values corresponding to stronger preference for private delivery
recode prior_1 prior_2 prior_3 (5=1) (4=2) (3=3) (2=4) (1=5)
generate pro_private = ((prior_1+ prior_2+ prior_3)-3)/12
histogram pro_private, discrete percent gap(0) xtitle(Support for public delivery) scheme(s2mono) 

*Variables are being coded to measure the (un)congeniality of the experimental material's information in light of respondents' attitudes (congeniality= pro_public if pub/A best and pro_private if priv/B best; uncongeniality is the reversed. NOTE: THESE VARIABLES MAKES NO SENSE IN PLACEBO GROUPS AND WILL NOT BE USED TO STUDY THOSE.
gen congeniality =.
replace congeniality = pro_public if pub_a_highestsatisfaction==1
replace congeniality = pro_private if pub_a_highestsatisfaction==0
gen uncongeniality =.
replace uncongeniality = pro_private if pub_a_highestsatisfaction==1
replace uncongeniality = pro_public if pub_a_highestsatisfaction==0

*An interaction term is being created in order to test H1 about stronger associations between attitudes and evaluations in grp C&D than in grp A&B
gen pro_publicXsector_revealed = pro_public*sector_revealed

/*-----------------------------------------------------------------
Test of H1: Motivated reasoning in the absence of justification requirements
-----------------------------------------------------------------*/

*H1 is being tested in group A&C (Model 4 of Supplementary Material S2: Regression Analyses Testing H1) 
logit correctanswer pro_public sector_revealed pro_publicXsector_revealed if pub_a_highestsatisfaction ==1 & group !=5 & attentive==1
*H1 is tested in group B&D (Model 5 of Supplementary Material S2: Regression Analyses Testing H1)
logit correctanswer pro_public sector_revealed pro_publicXsector_revealed if pub_a_highestsatisfaction ==0 & group !=6 & attentive==1
*We test the association between congeniality and respondents' ability to identify the best performing supplier in groups C and D (Model 6 of Supplementary Material S2: Regression Analyses Testing H1) 
logit correctanswer congeniality if sector_revealed ==1 & group !=5 & group !=6 & attentive==1

*General public panel in Figure 2 is being created
logit falseanswer uncongeniality if sector_revealed ==1  & group !=5 & group !=6 & attentive==1
margins, at(uncongeniality=(0(0.1)1)) vsquish
marginsplot, ytitle("Error rate") xtitle("Uncongeniality of information") legend(off) title("") graphregion(fcolor(white) lcolor(white)) recast(line) plotopts(lcolor(black)) recastci(rline) ciopts(lpattern(dash)) scheme(s2mono) 

/*-----------------------------------------------------------------
Coding of variables needed in order to test H3
-----------------------------------------------------------------*/

*A dummy variable is being coded to indicate whether 1: respondents have been asked to justify their evaluation (grp E&F) or 0: respondents have not been asked to justify their evaluation (grpC&D)
gen justification =.
replace justification = 1 if group==5
replace justification = 1 if group==6
replace justification = 0 if group==3
replace justification = 0 if group==4

*An interaction term is being created to test H3 about a moderating effect of justification requirements on the tendency to be biased by information-related attitudes
gen congenialityXjustification = congeniality*justification

/*-----------------------------------------------------------------
Test of H3: Debiasing effects of justification requirements?
-----------------------------------------------------------------*/

*H3 is being tested (Models 1-2 of Table 2: Moderating effects of justification requirements on influence of attitudes)
logit correctanswer congeniality justification if attentive==1 //Model 3 of Table 2
logit correctanswer congeniality justification congenialityXjustification if attentive==1 //Model 4 of Table 2

*Predicted probabilities of correctanswer=1 are estimated at different levels of congeniality with and without justification requirements 
logit correctanswer congeniality if justification ==0 & attentive==1
margins, at(congeniality = (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1))
logit correctanswer congeniality if justification ==1 & attentive==1
margins, at(congeniality = (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1))

/*-----------------------------------------------------------------
Explorative test of the effects of the impact of political interest among the general public (Reported in Supplementary Material S4: Influence of Political Interest)
-----------------------------------------------------------------*/

gen congenialityXpolint_veryhigh = congeniality * polint_veryhigh
logit correctanswer congeniality polint_veryhigh congenialityXpolint_veryhigh if group!=1 & group!=2 & justification==0 & attentive==1 //Model 1 of Supplementary Table S4
logit correctanswer congeniality justification congenialityXjustification if group!=1 & group!=2 & polint_veryhigh==1 & attentive==1 //Model 2 of Supplementary Table S4
logit correctanswer congeniality justification congenialityXjustification if group!=1 & group!=2 & polint_veryhigh==0 & attentive==1 //Model 3 of Supplementary Table S4

/*-----------------------------------------------------------------
Explorative analyses of the qualitative content of respondents' arguments/justifications (Reported in Supplementary Material S6: Qualitative Content Analysis of Written Justifications)
-----------------------------------------------------------------*/

*We look at the distributions of different justification types among recently elected and among experienced politicians (reported in Supplementary Material S6b)
tab justification_type_1 //justification type 1 (cf. coding scheme in Supplementary Material S6a) among all non-politicians
tab justification_type_1 if attentive==1 //justification type 1 (cf. coding scheme in Supplementary Material S6a) among attentive non-politicians
tab justification_type_2 //justification type 2 (cf. coding scheme in Supplementary Material S6a) among all non-politicians
tab justification_type_2 if attentive==1 //justification type 2 (cf. coding scheme in Supplementary Material S6a) among attentive non-politicians
tab justification_type_3 //justification type 3 (cf. coding scheme in Supplementary Material S6a) among all non-politicians
tab justification_type_3 if attentive==1 //justification type 3 (cf. coding scheme in Supplementary Material S6a) among attentive non-politicians
tab justification_type_4 //justification type 4 (cf. coding scheme in Supplementary Material S6a) among all non-politicians
tab justification_type_4 if attentive==1 //justification type 4 (cf. coding scheme in Supplementary Material S6a) among attentive non-politicians
tab justification_type_5 //justification type 5 (cf. coding scheme in Supplementary Material S6a) among all non-politicians
tab justification_type_5 if attentive==1 //justification type 5 (cf. coding scheme in Supplementary Material S6a) among attentive non-politicians
tab justification_type_99 //justification type 99 (cf. coding scheme in Supplementary Material S6a) among all non-politicians
tab justification_type_99 if attentive==1 //justification type 99 (cf. coding scheme in Supplementary Material S6a) among attentive non-politicians

*We test for associations between attitude congeniality and justification content (reported in Supplementary Material S6c)
gen justification_type_1_or_2 = .
replace justification_type_1_or_2 = 1 if justification_type_1==1
replace justification_type_1_or_2 = 1 if justification_type_2==1
replace justification_type_1_or_2 = 0 if justification_type_3==1
replace justification_type_1_or_2 = 0 if justification_type_4==1
replace justification_type_1_or_2 = 0 if justification_type_5==1
replace justification_type_1_or_2 = 0 if justification_type_99==1
logit justification_type_1_or_2 congeniality if correctanswer!=. //Model 3 of Supplementary Table S6ca (Note: the "correctanswer!=." command removes respondents who did not answer the dependent variable in our experiment)
logit justification_type_1_or_2 congeniality if attentive==1 & correctanswer!=. //Model 4 of Supplementary Table S6ca
logit justification_type_1 congeniality if correctanswer!=. //Model 3 of Supplementary Table S6cb
logit justification_type_1 congeniality if attentive==1 & correctanswer!=. //Model 4 of Supplementary Table S6cb
logit justification_type_2 congeniality if correctanswer!=. //Model 3 of Supplementary Table S6cc
logit justification_type_2 congeniality if attentive==1 & correctanswer!=. //Model 4 of Supplementary Table S6cc
logit justification_type_3 congeniality if correctanswer!=. //Model 3 of Supplementary Table S6cd
logit justification_type_3 congeniality if attentive==1 & correctanswer!=. //Model 4 of Supplementary Table S6cd
logit justification_type_4 congeniality if correctanswer!=. //Model 3 of Supplementary Table S6ce
logit justification_type_4 congeniality if attentive==1 & correctanswer!=. //Model 4 of Supplementary Table S6ce
logit justification_type_5 congeniality if correctanswer!=. //Model 3 of Supplementary Table S6cf
logit justification_type_5 congeniality if attentive==1 & correctanswer!=. //Model 4 of Supplementary Table S6cf
logit justification_type_99 congeniality if correctanswer!=. //Model 3 of Supplementary Table S6cg
logit justification_type_99 congeniality if attentive==1 & correctanswer!=. //Model 4 of Supplementary Table S6cg

/*-----------------------------------------------------------------
Analyses for Supplementary Material S5: Attention Check and Consequences of Excluding Inattentive Respondents
-----------------------------------------------------------------*/

*Table S5b: Attitudes and Ability to Identify Best Performing Supplier (H1) 
logit correctanswer pro_public sector_revealed pro_publicXsector_revealed if pub_a_highestsatisfaction ==1 & group !=5 //Groups A&C, all respondents (Model 1 of Supplementary Material S5b)
logit correctanswer pro_public sector_revealed pro_publicXsector_revealed if pub_a_highestsatisfaction ==0 & group !=6 //Groups B&D, all respondents (Model 2 of Supplementary Material S5b)
logit correctanswer congeniality if sector_revealed ==1 & group !=5 & group !=6 //Groups C&D, all respondents (Model 3 of Supplementary Material S5b)
logit correctanswer pro_public sector_revealed pro_publicXsector_revealed if pub_a_highestsatisfaction ==1 & group !=5 & attentive==1 //Groups A&C, attentive respondents only (Model 4 of Supplementary Material S5b)
logit correctanswer pro_public sector_revealed pro_publicXsector_revealed if pub_a_highestsatisfaction ==0 & group !=6 & attentive==1 //Groups B&D, attentive only (Model 5 of Supplementary Material S5b)
logit correctanswer congeniality if sector_revealed ==1 & group !=5 & group !=6 & attentive==1 //Groups C&D, attentive only (Model 6 of Supplementary Material S5b)

*Table S5c: Moderating Effects of Justification Requirements on the Influence of Attitudes (H3) 
logit correctanswer congeniality justification //all respondents (Model 1 of Supplementary Material S5c)
logit correctanswer congeniality justification congenialityXjustification //all respondents (Model 2 of Supplementary Material S5c)
logit correctanswer congeniality justification if attentive==1 //attentive respondents only (Model 3 of Supplementary Material S5c)
logit correctanswer congeniality justification congenialityXjustification if attentive==1 //attentive respondents only (Model 4 of Supplementary Material S5c)

*Table S5d: Influence of Political Interest
logit correctanswer congeniality polint_veryhigh congenialityXpolint_veryhigh if group!=1 & group!=2 & justification==0 //No justification required, all respondents (Model 1 of Supplementary Table S5d)
logit correctanswer congeniality justification congenialityXjustification if group!=1 & group!=2 & polint_veryhigh==1 //Very politically interested, all respondents (Model 2 of Supplementary Table S5d)
logit correctanswer congeniality justification congenialityXjustification if group!=1 & group!=2 & polint_veryhigh==0 //Not very politically interested, all respondents (Model 3 of Supplementary Table S5d)
logit correctanswer congeniality polint_veryhigh congenialityXpolint_veryhigh if group!=1 & group!=2 & justification==0 & attentive==1 //No justification required, attentive respondents only (Model 4 of Supplementary Table S5d)
logit correctanswer congeniality justification congenialityXjustification if group!=1 & group!=2 & polint_veryhigh==1 & attentive==1 //Very politically interested, attentive respondents only (Model 5 of Supplementary Table S5d)
logit correctanswer congeniality justification congenialityXjustification if group!=1 & group!=2 & polint_veryhigh==0 & attentive==1 //Not very politically interested, attentive respondents only (Model 6 of Supplementary Table S5d)

*Tables S5e (Differences Between Politicians' and Non-Politicians' Responses, H1) and S5f (Differences Between Politicians' and Non-Politicians' Responses, H3) are created at the bottom of this dofile, using the combined politician and general public dataset

/*-----------------------------------------------------------------
*****************************************
We move on to analyzing differences between politicians and the general public (Supplementary Material S3, S5e, and S5f)
*****************************************
-----------------------------------------------------------------*/

use "R:\Egen_forskning\Publicerede_papers\Christensen & Moynihan BPP - Motivated reasoning and policy information\Replication data and dofiles H1 H3\ReplicationData_PoliticiansGeneralPublicCombinedH1H3_ANONYMIZED.dta", clear
set more off

/*-----------------------------------------------------------------
Analyses for Supplementary Material S3: Differences between Politicians' and Non-Politicians' Responses
-----------------------------------------------------------------*/

*Table S3a: Differences Between Politicians' and Non-Politicians' Responses, H1
sum prior_1 prior_2 prior_3 
recode prior_1 prior_2 prior_3 (6=.)
recode prior_1 prior_2 (5=1) (4=2) (3=3) (2=4) (1=5)
alpha prior_1 prior_2 prior_3
generate pro_public = ((prior_1+ prior_2+ prior_3)-3)/12
tab pro_public
sum pro_public
recode prior_1 prior_2 prior_3 (5=1) (4=2) (3=3) (2=4) (1=5)
generate pro_private = ((prior_1+ prior_2+ prior_3)-3)/12
gen congeniality =.
replace congeniality = pro_public if pub_a_highestsatisfaction==1
replace congeniality = pro_private if pub_a_highestsatisfaction==0
gen pro_publicXsector_revealed = pro_public*sector_revealed
gen pro_pubXpolitician = pro_public * politician
gen sector_revealedXpolitician = sector_revealed * politician
gen propubXrevealedXpol = pro_public * sector_revealed * politician
*logit correctanswer pro_public sector_revealed politician age woman higher_education pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if attentive ==1 & pub_a_highestsatisfaction ==1 & group ! = 5 & group != 6 //Model 1 of Table S3a (This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer pro_public sector_revealed politician pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if attentive ==1 & pub_a_highestsatisfaction ==1 & group ! = 5 & group != 6 //Model 1 of Table S3a with background variables excluded (to ensure anonymity)
*logit correctanswer pro_public sector_revealed politician age woman higher_education pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if attentive ==1 &  pub_a_highestsatisfaction ==0 & group ! = 5 & group != 6 //Model 2 of Table S3a (This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer pro_public sector_revealed politician pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if attentive ==1 &  pub_a_highestsatisfaction ==0 & group ! = 5 & group != 6 //Model 2 of Table S3a with background variables excluded (to ensure anonymity)
gen congenialityXpolitician = congeniality * politician
*logit correctanswer congeniality politician age woman higher_education congenialityXpolitician if sector_revealed==1 & attentive ==1  & group ! = 5 & group != 6  //Model 3 of Table S3a (This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer congeniality politician congenialityXpolitician if sector_revealed==1 & attentive ==1  & group ! = 5 & group != 6  //Model 3 of Table S3a with background variables excluded (to ensure anonymity)

*Table S3c: Differences Between Politicians' and Non-Politicians' Responses, H3
gen justification =.
replace justification = 1 if group==5
replace justification = 1 if group==6
replace justification = 0 if group==3
replace justification = 0 if group==4
gen congenialityXjustification = congeniality*justification
gen justificationXpolitician = justification * politician
gen congenialityXjustXpol = congeniality * justification * politician
*logit correctanswer congeniality justification politician age woman higher_education congenialityXjustification congenialityXpolitician justificationXpolitician congenialityXjustXpol if attentive==1 //Table S3c (This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer congeniality justification politician congenialityXjustification congenialityXpolitician justificationXpolitician congenialityXjustXpol if attentive==1 //Table S3c with background variables excluded (to ensure anonymity)

/*-----------------------------------------------------------------
Analyses for Supplementary Material S5e and S5f: Consequences of excluding inattentive respondents for the differences between politicians and the general public in relation to H1 and H3
-----------------------------------------------------------------*/

*Table S5e: Differences Between Politicians' and Non-Politicians' Responses, H1
*logit correctanswer pro_public sector_revealed politician age woman higher_education pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if pub_a_highestsatisfaction ==1 & group ! = 5 & group ! = 6 //All respondents (Model 1 of Table S5e. This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer pro_public sector_revealed politician pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if pub_a_highestsatisfaction ==1 & group ! = 5 & group ! = 6 //All respondents (Model 1 of Table S5e; background variables excluded to ensure anonymity)
*logit correctanswer pro_public sector_revealed politician age woman higher_education pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if pub_a_highestsatisfaction ==0 & group ! = 5 & group ! = 6 //All respondents (Model 2 of Table S5e. This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer pro_public sector_revealed politician pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if pub_a_highestsatisfaction ==0 & group ! = 5 & group ! = 6 //All respondents (Model 2 of Table S5e; background variables excluded to ensure anonymity)
*logit correctanswer congeniality politician age woman higher_education congenialityXpolitician if sector_revealed==1 & group ! = 5 & group != 6  //All respondents (Model 3 of Table S5e. This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer congeniality politician congenialityXpolitician if sector_revealed==1 & group ! = 5 & group != 6  //All respondents (Model 3 of Table S5e; background variables excluded to ensure anonymity)
*logit correctanswer pro_public sector_revealed politician age woman higher_education pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if attentive ==1 & pub_a_highestsatisfaction ==1 & group ! = 5 & group ! = 6 //Attentive only (Model 4 of Table S5e. This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer pro_public sector_revealed politician pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if attentive ==1 & pub_a_highestsatisfaction ==1 & group ! = 5 & group ! = 6 //Attentive only (Model 4 of Table S5e; background variables excluded to ensure anonymity)
*logit correctanswer pro_public sector_revealed politician age woman higher_education pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if attentive ==1 &  pub_a_highestsatisfaction ==0 & group ! = 5 & group ! = 6 //Attentive only (Model 5 of Table S5e. This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer pro_public sector_revealed politician pro_publicXsector_revealed pro_pubXpolitician sector_revealedXpolitician propubXrevealedXpol if attentive ==1 &  pub_a_highestsatisfaction ==0 & group ! = 5 & group ! = 6 //Attentive only (Model 5 of Table S5e; background variables excluded to ensure anonymity)
*logit correctanswer congeniality politician age woman higher_education congenialityXpolitician if sector_revealed==1 & attentive ==1  & group ! = 5 & group != 6  //Attentive only (Model 6 of Table S5e. This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer congeniality politician congenialityXpolitician if sector_revealed==1 & attentive ==1  & group ! = 5 & group != 6  //Attentive only (Model 6 of Table S5e; background variables excluded to ensure anonymity)

*Table S5f: Differences Between Politicians' and Non-Politicians' Responses, H3
*logit correctanswer congeniality justification politician age woman higher_education congenialityXjustification congenialityXpolitician justificationXpolitician congenialityXjustXpol //All respondents (Model 1 of Table S5f. This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer congeniality justification politician congenialityXjustification congenialityXpolitician justificationXpolitician congenialityXjustXpol //All respondents (Model 1 of Table S5f; background variables excluded to ensure anonymity)
*logit correctanswer congeniality justification politician age woman higher_education congenialityXjustification congenialityXpolitician justificationXpolitician congenialityXjustXpol if attentive==1 //Attentive only (Model 2 of Table S5f. This is the full statistical model, which is being reported in the published Supplementary Material. It includes background data that might make it possible to identify respondents in the politician sample, meaning that we cannot share these data)
logit correctanswer congeniality justification politician congenialityXjustification congenialityXpolitician justificationXpolitician congenialityXjustXpol if attentive==1 //Attentive only (Model 2 of Table S5f; background variables excluded to ensure anonymity)
